import request from '@/config/axios'

// 分页
export const getPage = async (params: any) => {
  return await request.get({ url: `/promotion/groupon-package/page`, params })
}

// 详情
export const getDetailById = async (id: number | string) => {
  return await request.get({ url: `/promotion/groupon-package/get/` + id })
}

// 创建
export const create = async (data: any) => {
  return await request.post({ url: `/promotion/groupon-package/create`, data })
}

// 修改
export const updateById = async (data: any) => {
  return await request.post({ url: `/promotion/groupon-package/update`, data })
}

// 删除
export const deleteById = async (id: number | string) => {
  return await request.post({ url: `/promotion/groupon-package/delete/` + id })
}

// 添加赠品
export const addGifts = async (id: number | string, giftActivityIds: number[] | string[]) => {
  return await request.post({
    url: `/promotion/groupon-package/add-gifts`,
    data: { id, giftActivityIds }
  })
}

// 移除赠品
export const removeGift = async (id: number | string, giftActivityId: number | string) => {
  return await request.post({
    url: `/promotion/groupon-package/remove-gift`,
    data: { id, giftActivityId }
  })
}
